package com.ruoyi.business.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.ExtModelFieldMetadataTagMapper;
import com.ruoyi.business.domain.ExtModelFieldMetadataTag;
import com.ruoyi.business.service.IExtModelFieldMetadataTagService;

/**
 * 字段元数据标签Service业务层处理
 *
 * @author ruoyi
 * @date 2025-07-18
 */
@Service
public class ExtModelFieldMetadataTagServiceImpl implements IExtModelFieldMetadataTagService
{
    @Autowired
    private ExtModelFieldMetadataTagMapper extModelFieldMetadataTagMapper;

    /**
     * 查询字段元数据标签
     *
     * @param id 字段元数据标签主键
     * @return 字段元数据标签
     */
    @Override
    public ExtModelFieldMetadataTag selectExtModelFieldMetadataTagById(Long id)
    {
        return extModelFieldMetadataTagMapper.selectExtModelFieldMetadataTagById(id);
    }

    /**
     * 查询字段元数据标签列表
     *
     * @param extModelFieldMetadataTag 字段元数据标签
     * @return 字段元数据标签
     */
    @Override
    public List<ExtModelFieldMetadataTag> selectExtModelFieldMetadataTagList(ExtModelFieldMetadataTag extModelFieldMetadataTag)
    {
        return extModelFieldMetadataTagMapper.selectExtModelFieldMetadataTagList(extModelFieldMetadataTag);
    }

    /**
     * 新增字段元数据标签
     *
     * @param extModelFieldMetadataTag 字段元数据标签
     * @return 结果
     */
    @Override
    public int insertExtModelFieldMetadataTag(ExtModelFieldMetadataTag extModelFieldMetadataTag)
    {
        extModelFieldMetadataTag.setCreateTime(DateUtils.getNowDate());
        return extModelFieldMetadataTagMapper.insertExtModelFieldMetadataTag(extModelFieldMetadataTag);
    }

    /**
     * 修改字段元数据标签
     *
     * @param extModelFieldMetadataTag 字段元数据标签
     * @return 结果
     */
    @Override
    public int updateExtModelFieldMetadataTag(ExtModelFieldMetadataTag extModelFieldMetadataTag)
    {
        extModelFieldMetadataTag.setUpdateTime(DateUtils.getNowDate());
        return extModelFieldMetadataTagMapper.updateExtModelFieldMetadataTag(extModelFieldMetadataTag);
    }

    /**
     * 批量删除字段元数据标签
     *
     * @param ids 需要删除的字段元数据标签主键
     * @return 结果
     */
    @Override
    public int deleteExtModelFieldMetadataTagByIds(Long[] ids)
    {
        return extModelFieldMetadataTagMapper.deleteExtModelFieldMetadataTagByIds(ids);
    }

    /**
     * 删除字段元数据标签信息
     *
     * @param id 字段元数据标签主键
     * @return 结果
     */
    @Override
    public int deleteExtModelFieldMetadataTagById(Long id)
    {
        return extModelFieldMetadataTagMapper.deleteExtModelFieldMetadataTagById(id);
    }

    /**
     * 根据字段id删除字段元数据标签
     *
     * @param fieldId
     * @return
     */
    @Override
    public int deleteExtModelFieldMetadataTagByFieldId(Long fieldId) {
        return extModelFieldMetadataTagMapper.deleteExtModelFieldMetadataTagByFieldId(fieldId);
    }

    /**
     * 关联模型表，模型字段表，字段元数据标签表查询
     *
     * @param extModelFieldMetadataTag
     * @return
     */
    @Override
    public List<ExtModelFieldMetadataTag> listCombination(ExtModelFieldMetadataTag extModelFieldMetadataTag) {
        return extModelFieldMetadataTagMapper.listCombination(extModelFieldMetadataTag);
    }
}
